habiticafandomcom_es-20200214-history
Guía para Herreros
Los Herreros son vitales para el suceso de Habitica. ¡Sus contribuciones son muy necesarias y apreciadas! Hay varias maneras de contribuir tu código al sitio y las aplicaciones móviles. Un gran primer paso para familiarizarte con lo que se necesita hacer es leyendo toda esta página y las páginas enlazadas, además de unirte a la hermandad Aspiring Blacksmiths (Habitica Coders) para preguntar cualquier duda que tengas. Visita el blog de Habitica para Herreros The Forge para enterarte de anuncios importantes que necesiten llegar a todos los programadores. Asegúrate de leer Configurando Habitica localmente para información importante de como comenzar y luego Usar tu instalación local para modificar el sitio de Habitica y la API para aprender los procesos para crear cambios de código. Formas de Ayudar Sitio web A continuación hay consejos para encontrar items para trabajar en ellos, dependiendo de cómo te gustaría contribuir. En todos los casos, revisa las notas para conocer el estado actual del item y si alguien más está trabajando activamente en él (por ejemplo, si una petición está enlazada, alguien ha enviado ya un arreglo). Si alguien más ha comentado recientemente para decir que están trabajando en una GitHub issue o Trello card, por favor deja el trabajo para ellos. Sin embargo, si han pasado muchos días desde el último comentario, puede que ya no tengan tiempo de contribuir a Habitica, entonces sería apropiado preguntar si puedes encargarte. Antes de comenzar a trabajar, es importante que postees un comentario en el Github issue o Trello card para expresar tu interés y espera la respuesta de un administrador. Esto es porque algunos issues y peticiones de características no siempre son aptas de ser tomadas en cuenta. Esto se cumple incluso en los issues etiquetadas con las GitHub labels listados a continuación. Dependiendo del issue o característica, puede que quieras describir tu aproximación sugerida de tal forma que los administradores puedan comentar si es conveniente. * Quiero comenzar con poco: Revisa la cola de issues de Github y busca los items etiquetados como good first issue para encontrar issues en las que puedes solicitar contribuir. * Quiero ayudar donde sea más necesitado: Busca las issues etiquetadas como , , y y solicita contribuir antes de comenzar. Arreglar un bug etiquetado como te permitirá ganar el Critical Hammer of Bug-Crushing. Mientras trabajamos en pulir la reciente actualización de frontend, las issues serán revisadas primero y recibirán crédito de contribuidor. * Quiero crear unit tests y ''karma tests!: ¡Bienvenido, asesino de ''bugs! Refiérete a "Creating and Running Automated Tests" section in "Using Your Local Install to Modify Habitica's Website and API" para información a futuro. * Quiero construir cosas: ¡Hagan espacio para el nuevo héroe! Mira la cola de issues porque el staff, en ocasiones, crea issues para nuevas características que han sido aprobadas para implementación- Si no encuentras alg que te interese, puedes revisar Trello feature queue pero es vital que preguntes antes para saber si la característica que seleccionaste ha sido aprobada. Algunas sugerencias no son apropiadas para implementación y cualquier petición que las implemente no será aceptada. El repositorio del sitio web usa otras etiquetas además de las listadas arriba. Puedes leer acerca de ellas en GitHub Labels, pero las listadas arriba serán más útiles para encontrar issues para trabajar. App móvil para iOS * La app de Habitica para iOS tiene su propio código base en su propio repositorio de GitHub en github.com/HabitRPG/habitica-ios. Es open-source y se aceptan contribuciones. * Si quieres contribuir a la app de iOS, la [https://github.com/habitrpg/habitica-ios/issues lista de issues] contiene una lista de características sugeridas y bugs conocidos. Siéntete libre de revisarla para encontrar cosas en las que te gustaría trabajar. Para prevenir trabajo duplicado, tienes que dejar un comentario en el issue en el que quieres trabajar. Si quieres trabajar en una característica que no tiene un issue, primero crea uno, de tal forma que se puedan discutir los detalles de su implementación. App móvil para Android *La app de Habitica para Android tiene su propio repositoriio en github.com/HabitRPG/habitica-android. Es open source y se aceptan contribuciones. * Si quieres contribuir a la app de Android, la [https://github.com/habitrpg/habitica-android/ lista de issues] contiene una lista de características pedidas y bugs conocidos. Explórala para encontrar cosas en las que te gustaría trabajar. Para prevenir trabajo duplicado, deberás dejar un comentario en el issue en la que quieres trabajar. Si quieres trabajar en una característica que no tiene un issue, crea uno antes para que se puedan discutir los detalles. BountySource Algunos issues tendrán botines (bounties) en ellos, posteados por el staff o los usuarios. Si tu arreglo para un issue se acepta, podrás reclamar el dinero como pago. En las otras maneras, estos issues son tratados de la misma manera que los que no tienen botín, así que sigue todas las guías para ellos, por ejemplo, preguntar antes de trabajar en un issue. Website Technology Stack The technologies Habitica uses for its website are listed below. You don't need to be familiar with all of them, or even most of them, to be able to contribute! Some links to high-quality learning material are also included. Many of these technologies (namely, the ones with '.js' or 'JS' in the name or URL) are based on the programming language JavaScript, which you can learn here. Server Client Testing Services Working with a Local Installation Blacksmiths should create a local running instance of Habitica, for testing and development. The process to create a local instance can be difficult, so we've collected steps for each operating system at Setting up Habitica Locally. The process of using your local installation to make changes and create pull requests is described in Using Your Local Install to Modify Habitica's Website and API. MongoDB To learn how to use MongoDB, we recommend using the official MongoDB documentation or another reliable online resource, but here are a few examples of basic commands to help new developers gain a quick understanding of using the MongoDB. In the commands below, the $ sign indicates a Unix, Windows or Git Shell prompt and the > sign indicates a Mongo shell prompt. Type only the text that appears after $ or > into your command line. To access the Mongo shell and then select your local install's Habitica database: $ mongo > show dbs > use habitrpg Alternatively, directly start the shell with the database selected: $ mongo habitrpg View the "collections" in the database ("users", "groups", etc): > show collections View the full "document" for one user in the "users" collection (the user's User ID is 12345678-b5b9-4bb4-8b82-123456789abc): > db.users.find({_id: '12345678-b5b9-4bb4-8b82-123456789abc'})0 View only the preferences object from the user's document: > db.users.find({_id: '12345678-b5b9-4bb4-8b82-123456789abc'})0.preferences Change a value for the user using the update method with $set: > db.users.update({_id: '12345678-b5b9-4bb4-8b82-123456789abc'}, {$set: {'profile.name':'New Display Name'}}) Using Your Local Install to Modify Habitica's Website and API has advanced examples for specific purposes that are likely to be useful to you when testing your code changes. Vue/Node/Pug Tips and Best Practices Data Binding, and Template Conditionals When working in the Pug templates, you may see element attributes such as ng-class, ng-show, or ng-if. These are bindings used to map model data to elements for display that are part of AngularJS. These bindings can be used to define styles or display elements based on conditionals. You may also notice some other attributes such as bo-class or bo-if.... so what's the difference? Bindings that begin with "ng" are part of Angular and are completely dynamic. This means every time something changes with the app, Angular will test all of these bindings with conditionals and take action again. Obviously this is a concern for performance. AngularJS is no longer used as of 1/13/18. Sometimes the data used to calculate these conditionals will not change often, if ever. In that case, we have an option for static binding, using a library called Bindonce. These are similar bindings, but they are only checked at the initial load of the application.This is the preferred method of binding as long as the data will not change. Bindonce directives should only be used when the model data being used for the conditional will not change during a session, or will change infrequently enough that it's not unreasonable to expect the user to refresh the page. If this is not the case, then stick with traditional binding. If you can't decide or have no idea what you just read, just use the ng- attributes. Translatable Strings (locales files) Translatable strings appear in files in the website/common/locales/en directory. Each string consists of a key and a piece of text, for example: 'clearAll': 'clear all items', Do not edit files in other directories under website/common/locales because all translations are managed in Transifex. Always test your string additions and edits by viewing them in your local install. Never merely assume that even simple string additions will work as expected. Adding Translatable Strings To add a new translatable string write it in a Vue or JavaScript file using the t function. For example: env.t("newKey") i18n.t('newKey') Find existing strings in the file you are modifying for examples. Then, in the website/common/locales/en directory, edit the appropriate json files, adding the new string as follows: 'newKey': 'String Title', If there are already strings in the json file about the same topic, then it's preferred that you add your new string in the same place as the existing ones, to keep similar strings together. If there are no similar strings, add yours at the end of the file. Add a comma to the existing string that used to be the last string in the file. Do not add a comma to the end of your final string. Modifying Translatable Strings Existing strings can be changed whenever necessary. Do not change the keys unless there's a good reason to do so. For example: if you needed to change the string 'clear all items' to 'delete all items', you would not also change its key 'clearAll' to 'deleteAll', since the meaning of the original key is still accurate. The reason the keys are usually not changed is because they can be referenced in more than one place in Habitica's code and so all of those pieces of code would need to be updated; this is undesirable unless there's a good reason for it. In addition, when a key is changed the translators need to redo the translations without having the original translation visible for comparison. Note that when there is a reason to change the keys, you still should not modify the locales directories for languages other than English. Images For information about creating new images for Habitica, see Guidance for Artisans. When a new image has been prepared and approved by the staff, an issue will be created to request it be added to Habitica. A Blacksmith will then need to add it to the repository. Most images will need to be copied into suitable subdirectories under website/client/assets/ After adding new images or new versions of existing images, run npm run sprites to recompile the image spritesheets. Sometimes, this command will result in a new spritesheet being created, in which case use git add to add the new files. You will find them under website/client/assets/images/sprites/ and website/client/assets/css/sprites/ Other Useful Commands Here are various helpful commands. Search code You'll often want to search all files containing some keyword or string, to determine what files need to be edited when adding/editing some feature. Use the grep command (search online for information about grep on your operating system) or the git grep command (git documentation will teach you about how to use it). Preference Settings Habitica has preference settings for the users to customize the website's behavior. New settings may be added if necessary. Please do not add settings only a small proportion of users are likely to use, or settings for trivial customizations. Instead choose a behavior the majority of users are likely to enjoy. Too many preferences makes the settings screen look cluttered and increases the appearance of complexity. If you're uncertain about whether a preference setting is desirable, you can discuss it in the relevant GitHub issue or pull request. When a new user preference setting is necessary, it can be added to file(s) under website/server/models/user/. Generally, the database will then pick them up the new setting automatically and add it to user accounts as necessary. If it is ever necessary for the database to be modified manually, admins can do that. Generating Shrinkwrap Shrinkwrap is how we manage to lock in dependency versions for npm modules. This helps when deploying or distributing the app to multiple sources. The shrinkwrap file will update automatically if you use --save, but if you need to recompile manually, follow these steps: # Run npm prune # Run npm shrinkwrap "Information for Developers" Sections on General Wiki Pages At the bottom of some wiki pages, are sections called Information for Developers. These contain useful tips for Blacksmiths related to the content on that page. The information is hidden behind a spoiler-style show/hide toggle button so it doesn't clutter the page for non-technical users. The sections use the and templates to ensure correct formatting and wording for the buttons and other text. To see how that is done, open any page with an Information for Developers section in the source editor. To see a list of all pages with this section, use the "What links here" tool for the 'Start' template. To see all Information for Developers sections unhidden by default: * Create a Wikia account if you don't already have one. * Edit your personal Wikia css file, located at: http://habitica.wikia.com/wiki/User:YOUR_USERNAME_HERE/wikia.css * Insert these lines into CSS file: /* Force all "Information for Developers" sections to always be visible */ .habitrpg-InfoForDevs { display:block !important; } .habitrpg-InfoForDevs-hideIfDev { display:none; } You can see an example at User:LadyAlys/wikia.css Contributor Tier Process You're in luck! Blacksmiths do not need to do anything special, like complete a Contributor Tier request (as Scribes are requested to do), in order to earn Contributor Tiers. Contributor Tiers for Blacksmiths will be granted by the admins as they review and accept Blacksmith submissions. Admins will track Blacksmith contributions for credit toward future Contributor Tiers. The first one or two Contributor Tiers from Blacksmithing are fairly easy to get, and you might find that a single pull request being completed is enough for each of them. The higher tiers require progressively more work, and several successful pull requests might be needed. Admins will record each pull request when it is completed, and will award a tier when enough contributions have been made. Generally, when a PR is merged, an admin will write in both the PR and Hall of Heroes something like "I've given you Tier x" or "Noted toward your next contributor tier." If they write something like the latter, it means that PR alone was not enough for a tier by itself, or not enough to increase your tier to the next level if you already had other partial credit towards it. If an admin does not make any comment on your PR about credit towards contributor Tiers, please post to the PR to ask about it! Admins sometimes do forget and they always appreciate a gentle reminder because giving contributors credit for their work is important! See Also * Setting up Habitica Locally * Using Your Local Install to Modify Habitica's Website and API * Application Programming Interface * GitHub ** GitHub Labels ** BountySource ** Critical Hammer of Bug-Crushing * Wiki Pages that Include Information for Developers fr:Guide de la forge ru:Руководство_для_кузнецов,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, Categoría:Contribuciones Categoría:Avanzado Categoría:Ayuda Categoría:Herreros